$OpenBSD: patch-streamer_c,v 1.3 2015/01/21 09:22:51 dcoppa Exp $

commit 7ff29494a449a2c9039920c37f36550efaeb9024
Author: Alexey Yakovenko <wakeroid@gmail.com>
Date:   Fri Dec 12 22:15:33 2014 +0100

streamer: fix resuming network streams after losing network connection

--- streamer.c.orig	Tue Aug  5 12:54:03 2014
+++ streamer.c	Wed Jan 21 03:13:37 2015
@@ -52,6 +52,10 @@
 #include "plugins/libparser/parser.h"
 #include "strdupa.h"
 
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+#define alloca(size)   __builtin_alloca(size)
+#endif
+
 //#define trace(...) { fprintf(stderr, __VA_ARGS__); }
 #define trace(fmt,...)
 
@@ -1014,6 +1018,14 @@ streamer_set_current (playItem_t *it) {
     if (dec) {
         strncpy (decoder_id, dec, sizeof (decoder_id));
     }
+
+    if (!decoder_id[0]) {
+        // some decoders set filetype override,
+        // but the override is invalid when decoder is not set.
+        // reset to default here, so that tracks become playable after failures
+        pl_delete_meta(it, "!FILETYPE");
+    }
+
     const char *ft = pl_find_meta (it, ":FILETYPE");
     if (ft) {
         strncpy (filetype, ft, sizeof (filetype));
